/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/

@import '../custom.less';
@import './vars.less';

@steps-prefix-cls: ~'@{css-prefix}mobile-steps';

.@{steps-prefix-cls} {
  .component-css-vars-steps();

  color: var(--ti-mobile-steps-timeline-date-time-text-color);

  .line {
    background: var(--ti-mobile-steps-line-bg-color);
  }

  .icon {
    width: var(--ti-mobile-steps-icon-size);
    height: var(--ti-mobile-steps-icon-size);
    line-height: var(--ti-mobile-steps-icon-size);
    position: relative;
    text-align: center;
    left: ~'calc(50% - 10px)';
    top: 4px;
    border-radius: 50%;
    background: var(--ti-mobile-steps-icon-bg-color);
    color: var(--ti-mobile-steps-unselected-text-color);
    cursor: pointer;
    z-index: 15;
  }

  .date-time {
    text-align: center;
  }

  .node-description {
    position: relative;
    margin-top: 4px;
    overflow: hidden;
    text-align: center;

    .name {
      font-size: var(--ti-mobile-steps-font-size-base);
      float: left;
      width: 100%;
    }

    .status {
      font-size: var(--ti-mobile-steps-font-size-base);
      float: left;
      width: 100%;
    }
  }

  .process-done {
    .node-description {
      color: var(--ti-mobile-steps-done-text-color);
    }

    .icon {
      background: var(--ti-mobile-steps-done-icon-bg-color);
      color: var(--ti-mobile-steps-done-icon-fill-color);
      width: var(--ti-mobile-steps-icon-size);
      height: var(--ti-mobile-steps-icon-size);
      line-height: var(--ti-mobile-steps-icon-size);
      font-size: var(--ti-mobile-steps-icon-size);

      .@{css-prefix}svg {
        fill: var(--ti-mobile-steps-done-icon-fill-color);
        vertical-align: baseline;
        border: 1px solid var(--ti-mobile-steps-done-active-border-color);
        border-radius: 50%;
        padding: 2px;
      }
    }

    .line {
      background: var(--ti-mobile-steps-line-active-bg-color);
    }
  }

  .process-current {
    .node-description {
      color: var(--ti-mobile-steps-done-text-color);
    }

    .icon {
      border: none;
      background: var(--ti-mobile-steps-advanced-active-bg-color);
      color: var(--ti-mobile-steps-advanced-li-text-color);
      font-size: var(--ti-mobile-steps-font-size-base);
    }
  }

  .process-wait {
    .icon {
      border: 1px solid var(--ti-mobile-steps-unselected-text-color);
      box-sizing: border-box;
      font-size: var(--ti-mobile-steps-font-size-base);
    }
  }

  .reverse {
    .process-current {
      .line {
        background: var(--ti-mobile-steps-line-active-bg-color);
      }
    }
  }

  & &-normal {
    overflow: hidden;

    .normal {
      display: block;
      float: left;
    }

    .line {
      height: var(--ti-mobile-steps-line-height);
      left: 50%;
      top: -6px;
      position: relative;
    }

    .line-end {
      width: 0;
    }

    .process-done {
      .line {
        background: var(--ti-mobile-steps-line-active-bg-color);
      }
    }

    .process-current {
      .name {
        color: var(--ti-mobile-steps-advanced-active-bg-color);
        font-weight: bold;
      }
    }

    .icon {
      font-weight: 600;

      span {
        display: inline-block;
      }
    }
  }

  & &-timeline {
    overflow: hidden;
    font-size: var(--ti-mobile-steps-timeline-name-font-size);
    color: var(--ti-mobile-steps-timeline-date-time-text-color);

    .timeline {
      li {
        position: relative;
      }

      .header {
        display: flex;
        align-items: center;
        font-weight: 500;

        .date-time-vertical {
          width: 100px;
          font-size: 10px;
          line-height: 1.2;
          text-align: right;
          padding-right: 10px;
          box-sizing: border-box;
        }

        .round {
          position: relative;
          width: 7px;
          height: 7px;
          border-radius: 50%;
          z-index: 10;

          &-normal {
            border: 1px solid var(--ti-mobile-steps-unselected-text-color);
            box-sizing: border-box;
            background: var(--ti-mobile-steps-timeline-bg-color-normal);
          }

          &-success {
            background: var(--ti-mobile-steps-timeline-bg-color-success);
          }

          &-error {
            background: var(--ti-mobile-steps-timeline-bg-color-error);
          }

          &-handing {
            background: var(--ti-mobile-steps-timeline-bg-color-handing);
          }
        }

        .name {
          margin-left: 12px;
          height: 36px;
          line-height: 36px;
        }

        .arrow-btn {
          position: absolute;
          cursor: pointer;
          right: 16px;
          width: 20px;
          height: 20px;
          display: flex;
          justify-content: center;
          align-items: center;

          &-arrow {
            width: 8px;
            height: 8px;
            border-color: var(--ti-mobile-steps-arrow-btn-border-color);
            border-style: solid;
            border-width: 2px 2px 0 0;
            transform: rotate(-45deg);

            &-fold {
              transform: rotate(135deg);
            }
          }
        }
      }

      .content {
        margin-left: 19px;
        margin-right: 10px;

        &-left-margin {
          margin-left: 119px;
        }
      }

      .line {
        width: var(--ti-mobile-steps-line-height);
        position: absolute;
        left: 3px;
        top: 0;
        bottom: 0;
        z-index: 1;

        .@{css-prefix}svg {
          vertical-align: baseline;
        }
      }

      .line-left-margin {
        left: 103px;
      }

      &:first-child .line {
        top: 18px;
      }

      &:last-child .line {
        height: 18px;
      }

      .date-time {
        width: 100px;
        float: left;
        padding-right: 20px;
        text-align: right;

        .time {
          display: block;
          line-height: 1;
        }

        .date {
          display: block;
          line-height: 1;
          margin-bottom: 4px;
        }
      }

      &.process-done {
        color: var(--ti-mobile-steps-done-text-color);
      }

      &.process-current {
        color: var(--ti-mobile-steps-advanced-active-bg-color);
      }

      .name {
        float: left;
        margin-left: 20px;
        line-height: 1.45em;
      }

      .icon {
        top: 0;
      }
    }
  }

  &.mobile {
    padding-left: 10%;

    .@{steps-prefix-cls}-timeline {
      overflow: inherit;

      .@{css-prefix-iconfont} {
        font-size: 45px;
      }

      .timeline {
        .line {
          .icon {
            width: 45px;
            line-height: 45px;
            height: 45px;
            font-size: var(--ti-mobile-steps-font-size-7);
            position: relative;
            left: -20px;
          }
        }

        .name {
          margin-left: 30px;
          font-size: 26px;
        }

        & > div {
          margin-left: 20px;
        }
      }
    }
  }
}
